<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const obj = {
            uname: 'zs',
            age: '80'
        }

        const data = {
            num: 80
        }

        
      //  Object.defineProperty(obj,'sex'){
      //     value='看情况'
      //     writable:true         //可写属性
      //     enuremable:true        //可遍历属性
      //     configurable:true       //可修改属性
      //  }
        Object.defineProperty(obj,'sex',{
          get(){
            return data.num
          },

          set(value){
            data.num = value
          }
        })
        console.log(obj);
        
      
    </script>
</body>

</html>